import Vue from 'vue';
const changecolor = Vue.directive('changecolor', {
  bind:function(el){
    var jcolor;
    if(el.innerText<50){
      jcolor='#43CE17'
    }else if(el.innerText<100){
      jcolor='#EFDC31'
    }else if(el.innerText<150){
      jcolor='#FFAA00'
    }else if(el.innerText<200){
      jcolor='#FF401A'
    }else if(el.innerText<300){
      jcolor='#D20040'
    }else if(el.innerText>=300){
      jcolor='#9C0A4E'
    }
    el.style.background=jcolor
  },
  updated: function (el) {
    var jcolor1;
    if(el.innerText<50){
      jcolor1='#43CE17'
    }else if(el.innerText<100){
      jcolor1='#EFDC31'
    }else if(el.innerText<150){
      jcolor1='#FFAA00'
    }else if(el.innerText<200){
      jcolor1='#FF401A'
    }else if(el.innerText<300){
      jcolor1='#D20040'
    }else if(el.innerText>=300){
      jcolor1='#9C0A4E'
    }
    el.style.background=jcolor1
  }
})
export default changecolor;
